/*     */ package com.newcrm.webapi.sub;
/*     */ 
/*     */ import com.newcrm.bean.ExtInfo;
/*     */ import com.newcrm.util.Util;
/*     */ import com.newcrm.webapi.AbstractAction;
/*     */ import com.newcrm.webapi.AbstractHttpServlet;
/*     */ import java.util.Enumeration;
/*     */ import java.util.List;
/*     */ import javax.servlet.http.HttpServletRequest;
/*     */ 
/*     */ public abstract class AbstractAddUpdateCustomerDeal extends AbstractAction
/*     */ {
/*     */   public AbstractAddUpdateCustomerDeal()
/*     */   {
/*     */   }
/*     */ 
/*     */   public AbstractAddUpdateCustomerDeal(AbstractHttpServlet servlet)
/*     */   {
/*  20 */     super(servlet);
/*     */   }
/*     */ 
/*     */   protected void addFieldInfo(HttpServletRequest request, List<ExtInfo> extInfos)
/*     */   {
/*  26 */     Enumeration paramNames = request.getParameterNames();
/*  27 */     while (paramNames.hasMoreElements()) {
/*  28 */       String paramName = (String)paramNames.nextElement();
/*  29 */       if (paramName.contains("_"))
/*     */       {
/*  32 */         String[] array = paramName.split("_");
/*  33 */         if (array.length == 2)
/*     */         {
/*  37 */           if ("fieldId".equals(array[0]))
/*     */           {
/*  41 */             ExtInfo extInfo = new ExtInfo();
/*     */ 
/*  43 */             extInfo.type = Util.str2Int(array[1]);
/*     */ 
/*  45 */             String[] paramValues = request.getParameterValues("field_" + 
/*  46 */               extInfo.type);
/*  47 */             if ((paramValues != null) && (paramValues.length > 0)) {
/*  48 */               StringBuffer tmp = new StringBuffer(
/*  49 */                 Util.getURLParameter(paramValues[0]));
/*  50 */               for (int i = 1; i < paramValues.length; i++) {
/*  51 */                 tmp.append(",")
/*  52 */                   .append(Util.getURLParameter(paramValues[i]));
/*     */               }
/*  54 */               extInfo.info1 = tmp.toString();
/*     */             }
/*  56 */             extInfo.id = Util.getURLIntParameter(request
/*  57 */               .getParameter(paramName));
/*     */ 
/*  59 */             if ((extInfo.id != 0) || (
/*  60 */               (extInfo.info1 != null) && (extInfo.info1.trim().length() != 0)))
/*     */             {
/*  64 */               extInfos.add(extInfo);
/*     */             }
/*     */           }
/*     */         }
/*     */       }
/*     */     }
/*     */   }
/*     */ 
/*     */   protected void addExtInfo(HttpServletRequest request, String paramKey, List<ExtInfo> extInfos, int type)
/*     */   {
/* 105 */     String[] paramValues = request.getParameterValues(paramKey);
/* 106 */     String[] paramValueTypes = request
/* 107 */       .getParameterValues(paramKey + "Type");
/* 108 */     String[] paramValueIds = request.getParameterValues(paramKey + "Id");
/* 109 */     if ((paramValues == null) || (paramValues.length == 0)) {
/* 110 */       return;
/*     */     }
/* 112 */     if ((paramValueTypes == null) || (paramValueTypes.length == 0)) {
/* 113 */       return;
/*     */     }
/*     */ 
/* 116 */     for (int i = 0; i < paramValues.length; i++) {
/* 117 */       String paramValue = Util.getURLParameter(paramValues[i]);
/*     */ 
/* 135 */       String paramType = null;
/* 136 */       if (i < paramValueTypes.length) {
/* 137 */         paramType = Util.getURLParameter(paramValueTypes[i]);
/*     */       }
/*     */ 
/* 140 */       int id = 0;
/* 141 */       if ((paramValueIds != null) && (i < paramValueIds.length)) {
/* 142 */         id = Util.str2Int(paramValueIds[i]);
/*     */       }
/* 144 */       ExtInfo extInfo = new ExtInfo();
/* 145 */       extInfo.id = id;
/* 146 */       extInfo.type = type;
/* 147 */       extInfo.info1 = paramValue;
/* 148 */       extInfo.info2 = paramType;
/*     */ 
/* 151 */       if ((id > 0) || (
/* 152 */         (paramValue != null) && (paramValue.trim().length() != 0)))
/*     */       {
/* 157 */         if (type == 3) {
/* 158 */           String im = null;
/* 159 */           String[] ims = request.getParameterValues(paramKey + "Type1");
/* 160 */           if ((ims != null) && (i < ims.length)) {
/* 161 */             im = Util.getURLParameter(ims[i]);
/*     */           }
/* 163 */           extInfo.info3 = im;
/* 164 */         } else if (type == 6) {
/* 165 */           String province = null;
/* 166 */           String[] provinces = request.getParameterValues("province");
/* 167 */           if ((provinces != null) && (i < provinces.length)) {
/* 168 */             province = Util.getURLParameter(provinces[i]);
/*     */           }
/* 170 */           extInfo.info3 = province;
/*     */ 
/* 172 */           String city = null;
/* 173 */           String[] citys = request.getParameterValues("city");
/* 174 */           if ((citys != null) && (i < citys.length)) {
/* 175 */             city = Util.getURLParameter(citys[i]);
/*     */           }
/* 177 */           extInfo.info4 = city;
/*     */         }
/* 179 */         extInfos.add(extInfo);
/*     */       }
/*     */     }
/*     */   }
/*     */ }

/* Location:           C:\E\referenceProject\CRM参考\qikebao\WEB-INF\lib\qikebao.jar
 * Qualified Name:     com.newcrm.webapi.sub.AbstractAddUpdateCustomerDeal
 * JD-Core Version:    0.6.1
 */